#!/bin/bash
#
# ==========================================================
GA_HOME=/share/apps/ga
GA_BUILD=${GA_HOME}/build
GA_CLASSDIR=${GA_BUILD}/classes
GA_WORKDIR=${GA_HOME}/work
GA_SRCTOP=${GA_WORKDIR}/src
GA_TESTSRCTOP=${GA_WORKDIR}/src/test
GA_WORKSRCTOP=${GA_WORKDIR}/src/work
LIBROOT=${GA_HOME}/lib
JGAP_LIB=${LIBROOT}/jgap

MPI_CLASSDIR=${GA_BUILD}/classes/mpi
MPI_HOME=${GA_HOME}/work/src/mpj-v0_35
STARTER_DIR=${MPI_HOME}/src/runtime

JAVAC=${JAVA_HOME}/bin/javac
JAR=${JAVA_HOME}/bin/jar

STARTERSOURCES="${STARTER_DIR}/*.java \
${STARTER_DIR}/starter/*.java \
${STARTER_DIR}/daemon/*.java"


# ==========================================================
#CP="${LIBROOT}/mpj.jar:${LIBROOT}/jgap.jar:\
#${JGAP_LIB}/appframework-1.0.3.jar:\
#${JGAP_LIB}/commons-cli-1.0.jar:\
#${JGAP_LIB}/commons-codec-1.3.jar:\
#${JGAP_LIB}/commons-lang-2.1.jar:\
#${JGAP_LIB}/jcgrid.jar:\
#${JGAP_LIB}/jcommon-1.0.14.jar:\
#${JGAP_LIB}/jeksparser.jar:\
#${JGAP_LIB}/jfreechart-1.0.11.jar:\
#${JGAP_LIB}/junit3.8.1.jar:\
#${JGAP_LIB}/junit-addons-1.4.jar:\
#${JGAP_LIB}/swing-layout-1.0.3.jar:\
#${JGAP_LIB}/swing-worker-1.1.jar:\
#${JGAP_LIB}/TableLayout.jar:\
#${JGAP_LIB}/trove-2.0.2.jar:\
#${JGAP_LIB}/xpp3_min-1.1.3.4.O.jar:\
#${JGAP_LIB}/commons-math-2.0.jar:\
#${JGAP_LIB}/colt.jar:\
#${JGAP_LIB}/concurrent.jar:\
#${JGAP_LIB}/commons-math-2.0.jar:\
#${JGAP_LIB}/xstream-1.2.2.jar:\
#${LIBROOT}/pico/picocontainer-2.9.jar"

CP="${JGAP_LIB}/log4j.jar:\
${LIBROOT}/mpj.jar:\
${LIBROOT}/smpdev.jar:\
${LIBROOT}/mpjbuf.jar:\
${LIBROOT}/mpjdev.jar:\
${LIBROOT}/wrapper.jar:\
${LIBROOT}/org.mortbay.jetty.jar"
#${LIBROOT}/daemon.jar:\

echo "${JAVAC} -d ${MPI_CLASSDIR} -classpath ${CP} -nowarn ${STARTERSOURCES}"
${JAVAC} -d ${MPI_CLASSDIR} -classpath ${CP} -nowarn ${STARTERSOURCES} 

#echo "${JAR} -cfm ${GA_WORKDIR}/starter.jar ${MPI_HOME}/lib/META-INF/MANIFEST.MF -C ${MPI_CLASSDIR} runtime -C ${MPI_HOME}/lib/ META-INF/MANIFEST.MF "
#${JAR} -cf ${GA_WORKDIR}/starter.jar -C ${MPI_CLASSDIR} runtime -C ${MPI_HOME}/lib/ META-INF/MANIFEST.MF
echo "${JAR} -cfm ${LIBROOT}/starter.jar ${MPI_HOME}/lib/STARTER-META-INF/MANIFEST.MF -C ${MPI_CLASSDIR} runtime/MPJRuntimeException.class -C ${MPI_CLASSDIR} runtime/starter"
${JAR} -cfm ${LIBROOT}/starter.jar ${MPI_HOME}/lib/STARTER-META-INF/MANIFEST.MF -C ${MPI_CLASSDIR} runtime/MPJRuntimeException.class -C ${MPI_CLASSDIR} runtime/starter
#${JAR} -cfm ${GA_WORKDIR}/starter.jar ${MPI_HOME}/lib/META-INF/MANIFEST.MF -C ${MPI_CLASSDIR} runtime -C ${MPI_HOME}/lib META-INF
echo "${JAR} -cfm ${LIBROOT}/daemon.jar ${MPI_HOME}/lib/DAEMON-META-INF/MANIFEST.MF -C ${MPI_CLASSDIR} runtime/MPJRuntimeException.class -C ${MPI_CLASSDIR} runtime/daemon"
${JAR} -cfm ${LIBROOT}/daemon.jar ${MPI_HOME}/lib/DAEMON-META-INF/MANIFEST.MF -C ${MPI_CLASSDIR} runtime/MPJRuntimeException.class -C ${MPI_CLASSDIR} runtime/daemon
